import {reqTalkAll} from '../../api/talkIndex';
Page({
	data: {
		channelId:409,
		pageNo:1,
		pageSize:15,
		listData:[],
		loading:0
	},
	onLoad(options) {
		this.getData();
	},
	onReachBottom() {
		let page = this.data.pageNo+1;
		if(this.data.loading==2){
			return;
		}
		this.setData({pageNo:page,loading:1})
		this.getData();
	},
	async getData(){
		let {channelId,pageNo,pageSize} = this.data;
		let res = await reqTalkAll({channelId,pageNo,pageSize});
		if(res.code == 1){
			if(res.data.list.length==0){
				this.setData({loading:2});
			}else {
				this.setData({loading:0});
			}
			this.setData({listData:[...this.data.listData,...res.data.list]});
		}
	},
	toDetail(e){
		let id = e.currentTarget.dataset.id;
		wx.navigateTo({url: `/pages/talkPeoIntro/talkPeoIntro?id=${id}`})
	},
	toSelect(){
		wx.navigateTo({
			url: '/pages/talkSelect/talkSelect',
		})
	}
})